<div class="bjui-pageHeader">
    <form id="pagerForm" data-toggle="ajaxsearch" action="${request.getContextPath()}/WipDetail/wipDetail" method="post">
        <div class="bjui-searchBar">
            <g:hiddenField name="SYS_QUERY_NAME" value="wipDetail" />
            <g:hiddenField name="EXPORT_CONTENT_NAME" value="Excel" />
            <label >产品方向：</label>&nbsp;
            <input type="text" name="text" value="${text}"/>
            <label >产品编码：</label>&nbsp;
            <input type="text" name="partName" value="${partName}"/>
            <label >产品名称：</label>&nbsp;
            <input type="text" name="partDesc" value="${partDesc}"/>
            <label >工序编码：</label>&nbsp;
            <input type="text" name="stepName" value="${stepName}"/>
            <label >工序名称：</label>&nbsp;
            <input type="text" name="stepDesc" value="${stepDesc}"/>
            <label >产品图号：</label>&nbsp;
            <input type="text" name="group3" value="${group3}"/>
            <label >状态：</label>&nbsp;
            <input type="text" name="state" value="${state}"/>




            <button type="submit" class="btn-default" data-icon="search">查询</button>&nbsp;
            <button type="button" class="btn-blue" onclick="javascript:bjuiExportExl('#pagerForm','${request.getContextPath()}/OutsourcedProcessing/exportExcel')" data-icon="file-excel-o" title="导出Excel">导出</button>&nbsp;
        </div>
    </form>
</div>

<div class="bjui-pageContent">
    <g:if test="${wipDetail.size() > 0}">
        <table  data-toggle="tablefixed" data-width="100%" data-nowrap="true">
            <thead>
            <tr id="t1">
                <g:each in="${tableHeadList}" status="j" var="headInstance">
                    <g:if test="${headInstance!='RN'&&headInstance!='STATUS'}">
                        <th  width="125"><g:message code="${headInstance}" default="${headInstance}"/></th>
                    </g:if>
                </g:each>
            </tr>
            </thead>
            <tbody>
            <g:if test="${wipDetail.size()>0}">
                <g:each in="${wipDetail}" status="i" var="dataInstance">
                    <tr>
                        <g:each in="${tableHeadList}" status="j" var="headInstance">
                            <g:if test="${headInstance!='RN'&&headInstance!='WIP_QTY'&&headInstance!='STATUS'}">
                                <td>${dataInstance["${headInstance}"]}</td>
                            </g:if>
                            <g:elseif test="${headInstance=='WIP_QTY'&&headInstance!='STATUS'}">
                                <td name="DETAILQTY${i}"><a href="${request.getContextPath()}/WipDetail/wipDetailStep?state1=<%=dataInstance.STATUS%>&partName1=<%=dataInstance.SAVEPARTCODE%>&stepName1=<%=dataInstance.STEP_NAME%>" data-toggle="navtab"  data-id="dialog-normal" data-options="{id:'wipDetailStep', title:'在制品明细表二阶'}">${dataInstance["${headInstance}"] }</a></td>
                            </g:elseif>
                        </g:each>
                    </tr>
                </g:each>
                <tr>
                    <td colspan="6">小计</td>
                    <td name="detailShow"></td>
                </tr>
                <tr>
                    <td colspan="6">合计</td>
                    <td>${wipDetailSumQty.SUM_QTY[0]}</td>
                </tr>
            </g:if>
            <g:else>
                <g:render template="../template/emptyPanel" />
            </g:else>
            </tbody>
        </table>
    </g:if>
</div>
<g:render template="../template/pagination" />
<script>
    $(function(){
        var detailQty=0;
        for(var i=0;i<${wipDetail.size()};i++){
            var detailqty='DETAILQTY'+i
            var detailQtyAdd=$("td[name='"+detailqty+"']").text()==''?0:parseInt($("td[name='"+detailqty+"']").text())
            detailQty+=detailQtyAdd
        }
        $("td[name='detailShow']").html(detailQty)

    })
</script>
